package com.mhkj.base.rbac.permission.entity;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.mhkj.base.rbac.role.entity.SystemRole;
import com.mics.core.common.validate.annotation.Validate;
import com.mics.core.system.base.entity.BaseDomain;

@Entity
@Table(name = "t_sys_permission")
@Validate
public class Permission extends BaseDomain {
	/**
	 * 序号
	 */
	private static final long serialVersionUID = 1611298667763895757L;
	@Column(name="name")
	private String name;// 名称.
	
	@Column(name = "resource_type")
	private int resourceType=0;// 资源类型，[menu|button]
	
	
	@Column(name="url")
	private String url;// 资源路径.
	
	
	@Column(name="permission")
	private String permission; // 权限字符串,menu例子：role:*，button例子：role:create,role:update,role:delete,role:view
	
	
	@Column(name="pId")
	private Long pId; // 父编号
	
	private String pIds; // 父编号列表
	
	@Column(name="available")
	private int available = 0;
	
	
	@ManyToMany(fetch=FetchType.LAZY)
	@JoinTable(name = "t_sys_role_permission", joinColumns = { @JoinColumn(name = "permission_id") }, inverseJoinColumns = {@JoinColumn(name = "role_id") })
	private List<SystemRole> systemRoles;

	@Transient
	private String creatName;

	public String getCreatName() {
		return creatName;
	}

	public void setCreatName(String creatName) {
		this.creatName = creatName;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	
	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getPermission() {
		return permission;
	}

	public void setPermission(String permission) {
		this.permission = permission;
	}

	 
	public Long getpId() {
		return pId;
	}

	public void setpId(Long pId) {
		this.pId = pId;
	}

	public String getpIds() {
		return pIds;
	}

	public void setpIds(String pIds) {
		this.pIds = pIds;
	}

	

	public int getResourceType() {
		return resourceType;
	}

	public void setResourceType(int resourceType) {
		this.resourceType = resourceType;
	}

	public int getAvailable() {
		return available;
	}

	public void setAvailable(int available) {
		this.available = available;
	}

	public List<SystemRole> getSystemRoles() {
		return systemRoles;
	}

	public void setSystemRoles(List<SystemRole> systemRoles) {
		this.systemRoles = systemRoles;
	}

	

}
